package cn.qyd.threadsignal;

import java.util.concurrent.CountDownLatch;

/**
 * @author 邱运铎
 * @date 2024-03-19 11:58
 */
public class CountDownLatchDemo01 {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch latch = new CountDownLatch(5);
        Thread t = new Thread(() -> {
           for (int i = 0; i < 5; i++) {
               System.out.println("for running");
               latch.countDown();
           }
        });

        t.start();
        latch.await();
        System.out.println("countDownLatch always count down 0");
    }
}
